refactor(plugin-rsc): convert hooks to nested handler form#1093
Merged
refactor(plugin-rsc): convert hooks to nested handler form#1093
Conversation
Convert all direct function hooks (resolveId, load, transform) to nested
handler object form in preparation for adding Vite hook filter support.
Before:
resolveId(source) { ... }
load(id) { ... }
transform(code, id) { ... }
After:
resolveId: { handler(source) { ... } }
load: { handler(id) { ... } }
transform: { handler(code, id) { ... } }
This is a pure structural refactoring with no functional changes.
Ref: #861
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tip
Use "hide whitespaces" to review the change https://github.com/vitejs/vite-plugin-react/pull/1093/files?diff=split&w=1
Summary
resolveId,load,transform) to nested handler object formBefore:
After:
Files Changed
src/plugin.ts- Main plugin file (19 hooks converted)src/core/plugin.ts- Core plugin (1 hook)src/plugins/cjs.ts- CJS transform plugin (1 hook)src/plugins/import-environment.ts- Environment import plugin (1 hook)src/plugins/scan.ts- Scan build plugin (1 hook)src/plugins/utils.ts- Virtual plugin helper (2 hooks)src/plugins/validate-import.ts- Import validation plugin (1 hook)Test plan
pnpm -C packages/plugin-rsc tsc)pnpm -C packages/plugin-rsc build)pnpm -C packages/plugin-rsc test)🤖 Generated with Claude Code